
  import { createRouter, createWebHashHistory } from 'vue-router'

import Main from '../framework/Home'
import Login from '../framework/Login'

import Err404 from '../framework/Error'
import Err401 from '../framework/401'

const home = () => import('@/sys/home')

const person = () => import('@/page/person')

const routes = [
  { path: '/login', component: Login, name: '登录' },
  {
    path: '/',
    component: Main,
    redirect: '/home',
    name: 'ep',
    children: [
      { path: 'home', component: home, name: '首页', meta: {} },
      { path: 'person', component: person, name: '个人中心', meta: {} }
    ]
  },
  { path: '/401', name: '401 No Permission!', component: Err401 },
  { path: '/*', name: '404 not found!', component: Err404 }
]

// 解决导航栏中的vue-router在3.0版本以上重复点菜单报错问题
// const originalPush = Router.prototype.push
// Router.prototype.push = function push(location) {
//   return originalPush.call(this, location).catch(err => err)
// }

const router = createRouter({
  history: createWebHashHistory(process.env.BASE_URL),
  routes
})
export default router
